<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增汇款信息" bodyClass="white-bg" libs=["prism","bootstrapSelect","ueditor"]/>
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-remittance-add"  class="form-horizontal">
    <input  type="hidden" name="delFlag" value="0">
    <input name="saleOrderNumber" value="${saleOrderNumber}" class="form-control" type="hidden">
    <input name="userId" value="${user.id}" class="form-control" type="hidden">
    <input name="saleUserid" value="1" class="form-control" type="hidden">
    <input name="processStatus" value="1" class="form-control" type="hidden">
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "申请人"/>：
    </label>
        <div class="col-sm-8"><input class="form-control" type="text" value="${user.name}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "销售员"/>：
    </label>
        <div class="col-sm-8"><input name="saleUsername" class="form-control" type="text" value="${bpmCrmRemittance.saleUsername?default('张三')}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "销售订单编号"/>：
    </label>
        <div class="col-sm-8"><input name="saleCode" class="form-control" type="text" value="${bpmCrmRemittance.saleCode?default('3213213213')}"  readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "车辆识别号"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVin" class="form-control" type="text" value="${bpmCrmRemittance.outCarVin?default('321321')}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "车型"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVehicle" class="form-control" type="text" value="${bpmCrmRemittance.outCarVehicle?default('321321321')}" readonly="true">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "费用发生日期"/>：</label>
        <div class="col-sm-8">
            <div class="input-group date">
                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                <input class="form-control time-input" name="remittanceCostTime"  data-type="date" data-format="yyyy-MM-dd" type="text"  required/>
            </div>
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "报销金额"/>：
       </label>
        <div class="col-sm-8"><input name="remittancereimburseAmount" class="form-control" type="number"  required>
        </div>
     </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "凭证"/>：
       </label>
        <div class="col-sm-8">

            <div class="layui-upload">
                <button type="button" class="btn btn-success btn-sm" id="proofList"><i class="fa fa-upload"></i> 上传凭证</button>
                <div class="layui-upload-list layui-upList-minHeight uploadpadding">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="demoproofList">
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item layui-btn-Center">
                    <div class="layui-input-block text-right">
                        <button type="button" class="layui-btn layui-btn-xs" id="proofListAction">开始上传</button>
                    </div>
                </div>
            </div>

        </div>
     </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "备注"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRemark" class="form-control" type="text"  required>
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "首选付款方式"/>：</label>
        <div class="col-sm-8">
              <@form.radio name="remittanceFirstPaymethod" dictType="sys_crm_paymethod" value="${bpmCrmRemittance.remittanceFirstPaymethod?default('0')}" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "备忘录"/>：</label>
        <div class="col-sm-8">
            <textarea name="remittanceMemo" class="form-control" required></textarea>
        </div>
    </div>
               
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人姓名"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRecipientName" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人地址"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRecipientAddress" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group checkClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人手机"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRecipientPhone" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "金额"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceAccount" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "汇款路径号码"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRouting" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group wireClass">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "银行地址"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceBankaddress" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group rmbClass">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "人民币汇款方式"/>：</label>
        <div class="col-sm-8">
              <@form.radio name="remittanceRmbPaymethod" dictType="sys_crm_isOrNo" value="${bpmCrmRemittance.remittanceRmbPaymethod?default('1')}" />
        </div>
    </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "银行名称"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRmbBankname" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group rmbClassMoney">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "银行账户"/>：
       </label>
        <div class="col-sm-8"><input name="remittanceRmbBankaccount" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group rmbClassMoney">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "账户名"/>：</label>
        <div class="col-sm-8">
            <textarea name="remittanceRmbAccountname" class="form-control" required></textarea>
        </div>
    </div>

               
</@form.form>
</div>
<@footer>
    <script type="text/javascript">
        var prefix = baseURL + "bpm/remittance"
        $("#form-remittance-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if (opt.validate.form()) {
                opt.operate.save(prefix + "/add", $('#form-remittance-add').serialize());
            }
        }


        //在插件中使用对象
        $.fn.upfile = function(type) {
            var upfile = new Upfile(this,'',$("input[name='saleOrderNumber']").val(),type);
            layui.use('upload', function() {
                var upload = layui.upload;
                var UplodeIn = upload.render(upfile.options);
                upfile.SetInst(UplodeIn)

            });

        };
        /**
         * 凭证
         */
        $('#proofList').upfile(18);

        /**
         * redio 单选回调
         * @param id
         * @param data
         * @param event
         */
        function  redioCallback(id,data,event){

            if(id == "remittanceFirstPaymethod"){
                if ($(data).is(':checked')){
                    var menuType = $(event.target).val();
                    if(menuType=="0"){
                        $(".rmbClass").show();
                        $(".wireClass").hide();
                        $(".checkClass").hide();
                        var rmbStatus=$("[name='remittanceRmbPaymethod']")[0].checked;
                        if(rmbStatus){
                            $(".rmbClassMoney").show();
                        }
                        else{
                            $(".rmbClassMoney").hide();
                        }
                    }
                    else if(menuType=="1"){
                        $(".rmbClass").hide();
                        $(".wireClass").hide();
                        $(".checkClass").hide();
                        $(".rmbClassMoney").hide();
                    }
                    else if(menuType=="2"){
                        $(".rmbClass").hide();
                        $(".wireClass").hide();
                        $(".checkClass").show();
                        $(".rmbClassMoney").hide();
                    }
                    else if(menuType=="3"){
                        $(".rmbClass").hide();
                        $(".wireClass").show();
                        $(".checkClass").show();
                        $(".rmbClassMoney").hide();
                    }
                }
            }
            else if(id == "remittanceRmbPaymethod"){
                if ($(data).is(':checked')){
                    var valueType = $(event.target).val();
                    if(valueType=="1"){
                        $(".rmbClassMoney").show();
                    }
                    else{
                        $(".rmbClassMoney").hide();
                    }
                }
            }
        }

    </script>
</@footer>
</@pageTheme>